import { http } from "@/utils/http";
import { Result, arrayResult } from "../types";

type data = {
  agvid?: number,
  agvname?: string,
  ip?: string,
  model?: string,
  status?: number,
  vehicletype?: number,
  note?: string
};

type search = {
  name?: string,
  Name?: string,
  pageNumber: number,
  pageSize: number,
  sortName: string,
  sortType: number
}

type select = {
  state: number
}

// 交管列表
export const crossList = (params?: search) => {
  return http.request<Result>("get", "/api/cross/List", { params });
};

// 新增交管
export const addCross = (data: data) => {
  return http.request<Result>("post", "/api/cross/Add", { data });
};

// 修改交管
export const updateCross = (data: data) => {
  return http.request<Result>("post", "/api/cross/Update", { data });
};

// 删除交管
export const delCross = (id: number) => {
  return http.request<Result>("post", `/api/cross/Delete/${id}`, {});
};

// 交管下拉
export const GetAllCross = (params: select) => {
  return http.request<arrayResult>("get", "/api/cross/GetAllCross", { params });
};

// 详情
export const getCross = (id?: number) => {
  return http.request<Result>("get", `/api/cross/Get/${id}`, {});
};
